-
Notifications
You must be signed in to change notification settings - Fork 5
chore(vmop): refactoring vmop restore/clone #1925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
7bfa8e2 to
fac98f5
Compare
images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/step/process_clone_step.go
Outdated
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/step/process_clone_step.go
Outdated
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/step/process_clone_step.go
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/step/process_clone_step.go
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/step/process_clone_step.go
Show resolved
Hide resolved
.../virtualization-artifact/pkg/controller/vmop/snapshot/internal/step/cleanup_snapshot_step.go
Outdated
Show resolved
Hide resolved
.../virtualization-artifact/pkg/controller/vmop/snapshot/internal/step/exit_maintenance_step.go
Outdated
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/service/clone.go
Outdated
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/service/clone.go
Outdated
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/service/clone.go
Outdated
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/service/clone.go
Outdated
Show resolved
Hide resolved
...s/virtualization-artifact/pkg/controller/vmop/snapshot/internal/step/create_snapshot_step.go
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/step/final_step.go
Outdated
Show resolved
Hide resolved
7995d93 to
8d47ebc
Compare
Signed-off-by: Valeriy Khorunzhin <[email protected]> refactoring Signed-off-by: Valeriy Khorunzhin <[email protected]> fix Signed-off-by: Valeriy Khorunzhin <[email protected]> remove printf Signed-off-by: Valeriy Khorunzhin <[email protected]> fix e2e Signed-off-by: Valeriy Khorunzhin <[email protected]> total rewriting Signed-off-by: Valeriy Khorunzhin <[email protected]> fixes Signed-off-by: Valeriy Khorunzhin <[email protected]> tests Signed-off-by: Valeriy Khorunzhin <[email protected]> fix linter Signed-off-by: Valeriy Khorunzhin <[email protected]> fix linter 2 Signed-off-by: Valeriy Khorunzhin <[email protected]> final -> completed Signed-off-by: Valeriy Khorunzhin <[email protected]> resolve Signed-off-by: Valeriy Khorunzhin <[email protected]>
Signed-off-by: Valeriy Khorunzhin <[email protected]>
8d47ebc to
0bf2045
Compare
| // Run execute until the operation is completed. | ||
| if svcOp.IsInProgress() { | ||
| return h.execute(ctx, vmop, svcOp) | ||
| if _, found := conditions.GetCondition(vmopcondition.TypeCompleted, vmop.Status.Conditions); found { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to comment, it should be !found or at least Status should be checked. Or change comment for more clarification.
...virtualization-artifact/pkg/controller/vmop/snapshot/internal/step/enter_maintenance_step.go
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/step/final_step_test.go
Outdated
Show resolved
Hide resolved
| Expect(phase1).To(Equal(phase2)) | ||
| Expect(phase2).To(Equal(phase3)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These asserts may generate unexpected results if phase in Equal 2 is not "Completed":
Something like "Test failed, expect Failed, got Completed"
...irtualization-artifact/pkg/controller/vmop/snapshot/internal/step/process_clone_step_test.go
Outdated
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/step/suite_test.go
Show resolved
Hide resolved
.../virtualization-artifact/pkg/controller/vmop/snapshot/internal/step/vmsnapshot_ready_step.go
Outdated
Show resolved
Hide resolved
...irtualization-artifact/pkg/controller/vmop/snapshot/internal/step/waiting_disk_ready_step.go
Outdated
Show resolved
Hide resolved
...irtualization-artifact/pkg/controller/vmop/snapshot/internal/step/waiting_disk_ready_step.go
Outdated
Show resolved
Hide resolved
Signed-off-by: Valeriy Khorunzhin <[email protected]>
Signed-off-by: Valeriy Khorunzhin <[email protected]>
Signed-off-by: Valeriy Khorunzhin <[email protected]>
Description
Refactored VMOP Restore/Clone Controller
This PR refactors the VirtualMachineOperation controller for restore and clone operations. The implementation now uses a unified step-based execution flow, improving code maintainability and consistency between restore and clone operations.
Condition Changes
The RestoreCompleted and CloneCompleted conditions have been deprecated and removed. Both operations now use the unified Completed condition with appropriate reasons (ReasonRestoreInProgress, ReasonCloneInProgress, ReasonOperationCompleted, ReasonOperationFailed) to track operation progress and completion status.
Testing
Unit tests have been added to cover the refactored restore and clone step implementations.
Checklist